<?php

    class Application_Form_EventForm extends Zend_Form
    {

        private $front;
        
        public function setFront($param){
            $this->front = $param;
        }
        public function init()
        {
            $this->setMethod("post");

            $country_records = array();
            $model = new Application_Model_Common();
            $get_countries = $model->getAllRecordDetail(TABLE_COUNTRY, "1", "country_name");
            foreach ($get_countries as $gc_key => $gc_value)
            {
                $country_records[$gc_value["country_id"]] = $gc_value["country_name"];
            }

            $this->addElement("hidden", "event_id");

            $this->addElement("text", "event_title", array(
                "placeholder" => "Active field for",
                "class" => "input required",
                "required" => "true"
            ));
            
            if($this->front){
                
                $this->event_title->setAttribs(array('class'=>'input radius',
                                                     'onfocus'=>"this.style.borderColor = '#1996d4'",
                                                     'onblur'=>"this.style.borderColor = '#cfcfcf'"   
                    ));
            }
            
            //category select box
            
            $this->addElement("hidden","event_cat_id",array(
                "required"=>true,
                "style"=>"height:25px;"
              
            ));
            
            
            $this->addElement("hidden","event_subcat_id",array(
                "required"=>true
            ));
            
            $this->addElement("text","event_group_size",array(
                "required"=>true,
                "class"=>"input radius"
            ));
            
            
            
            //gcm($this->event_group_type); die;
            

            $this->addElement("text", "event_address", array(
                "placeholder" => "Event Address",
                "class" => "input radius",
                "required" => "true",
                "onfocus"=>"this.style.borderColor = '#1996d4'",
                "onblur"=>"this.style.borderColor = '#cfcfcf'",
                "style"=>"border-color: rgb(207, 207, 207);"
            ));

            $this->addElement("text", "event_city", array(
                "placeholder" => "Event City",
                "class" => "input radius",
                "required" => "true",
                "onfocus"=>"this.style.borderColor = '#1996d4'",
                "onblur"=>"this.style.borderColor = '#cfcfcf'",
                "style"=>"border-color: rgb(207, 207, 207);"
            ));

            $this->addElement("text", "event_state", array(
                "placeholder" => "Event State",
                "class" => "input radius",
                "required" => "true",
                "onfocus"=>"this.style.borderColor = '#1996d4'",
                "onblur"=>"this.style.borderColor = '#cfcfcf'",
                "style"=>"border-color: rgb(207, 207, 207);"
            ));

            $this->addElement("hidden","event_country",array(
                "required"=>"true"
            ));

            for ($i_day = "1"; $i_day <= "31"; $i_day++)
            {
                $date_day_array[$i_day] = $i_day;
            }
            for ($i_month = "1"; $i_month <= "12"; $i_month++)
            {
                $date_month_array[$i_month] = $i_month;
            }
            for ($i_year = "1990"; $i_year <= date("Y"); $i_year++)
            {
                $date_year_array[$i_year] = $i_year;
            }

            $this->addElement("radio", "event_date_type", array(
                "required" => "true"
            ));
            $this->event_date_type->addMultiOptions(array("recurring" => "Recurring", "single" => "Single Term Event"));
            $this->event_date_type->setValue("recurring");

            $this->addElement("select", "date_day", array(
                "required" => "true"
            ));
            $this->date_day->addMultiOptions($date_day_array);

            $this->addElement("select", "date_month", array(
                "required" => "true"
            ));
            $this->date_month->addMultiOptions($date_month_array);

            $this->addElement("select", "date_year", array(
                "required" => "true"
            ));
            $this->date_year->addMultiOptions($date_year_array);

            for ($i_hour = "0"; $i_hour <= "23"; $i_hour++)
            {
                $time_hour_array[$i_hour] = $i_hour;
            }

            for ($i_minute = "0"; $i_minute <= "59"; $i_minute++)
            {
                $time_minute_array[$i_minute] = $i_minute;
            }

            $this->addElement("select", "time_hour", array(
                "required" => "true"
            ));
            $this->time_hour->addMultiOptions($time_hour_array);

            $this->addElement("select", "time_minute", array(
                "required" => "true"
            ));
            $this->time_minute->addMultiOptions($time_minute_array);

            $this->addElement("radio", "time_am_pm", array(
                "required" => "true"
            ));
            $this->time_am_pm->addMultiOptions(array("am" => "AM", "pm" => "PM"));
            $this->time_am_pm->setValue("pm");

            $this->addElement("textarea", "event_info", array(
                "placeholder" => "Event Info",
                "class" => "radius area",
                "required" => "true",
                "onfocus"=>"this.style.borderColor = '#1996d4'",
                'onblur'=>"this.style.borderColor = '#cfcfcf'",
                'style'=>"border-color: rgb(207, 207, 207);"
            ));

            $this->addElement("file", "event_images", array(
                "placeholder" => "Browse",
                "class" => "input",
            ));

            $this->addElement("text", "event_video", array(
                "placeholder" => "Input URL",
                "class" => "input radius",
                "style"=>"border-color: rgb(207, 207, 207);",
                "onblur"=>"this.style.borderColor = '#cfcfcf';this.style.color = '#1996d4';",
                "onfocus"=>"this.style.borderColor = '#1996d4';this.style.color = '#000';"
            ));

            $this->addElement("radio", "event_type", array(
                "required" => "true"
            ));
            $this->event_type->addMultiOptions(array("public" => "Public", "private" => "Private"));
            $this->event_type->setValue("private");

            $this->addElement("radio", "event_celebrity_event", array(
                "required" => "true"
            ));
            $this->event_celebrity_event->addMultiOptions(array("1" => "Yes", "0" => "No"));
            $this->event_celebrity_event->setValue("0");

            $elements = $this->getElements();
            foreach ($elements as $element)
            {
                $element->removeDecorator("DtDdWrapper")->removeDecorator("HtmlTag")->removeDecorator("Label");
            }
        }

    }

    